package com.example.nacos.service.IndicatorCal;

import java.util.HashMap;
import java.util.Map;

public class MetricsResult {
    private String productId;
    private String productType;
    private Map<String, Double> metrics = new HashMap<>();

    public MetricsResult(String productId, String productType) {
        this.productId = productId;
        this.productType = productType;
    }

    public void addMetric(String period, String metricName, Double value) {
        String key = period + metricName;
        metrics.put(key, value);
    }

    public Double getMetric(String period, String metricName) {
        return metrics.get(period + metricName);
    }

    // Getters and Setters
    public String getProductId() { return productId; }
    public void setProductId(String productId) { this.productId = productId; }

    public String getProductType() { return productType; }
    public void setProductType(String productType) { this.productType = productType; }

    public Map<String, Double> getMetrics() { return metrics; }
    public void setMetrics(Map<String, Double> metrics) { this.metrics = metrics; }

    @Override
    public String toString() {
        return String.format("MetricsResult{productId='%s', productType='%s', metrics=%s}",
                productId, productType, metrics);
    }
}